package
{
	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.net.URLRequest;
	import flash.net.URLStream;
	import flash.system.ApplicationDomain;
	import flash.system.LoaderContext;
	import flash.text.TextField;
	import flash.utils.ByteArray;
	import flash.utils.getDefinitionByName;
	
	[SWF(width="960",height="560")]
	public class yunA extends Sprite
	{
		private var loadArr:Array = ["swc/TaomeeLibraryDLL.swf","swc/ClientXMLDLL.swf","swc/ClientCoreDLL.swf"]
		
		public function yunA()
		{
			doLoad()
		}
		
		private function doLoad():void
		{
			var stream:URLStream = new URLStream();
			stream.addEventListener(Event.COMPLETE,streamCom);
			stream.load(new URLRequest(loadArr[0]));
			loadArr.splice(0,1);
		}
		
		private function streamCom(e:Event):void
		{
			var stream:URLStream = e.currentTarget as URLStream;
			stream.removeEventListener(Event.COMPLETE,streamCom);
			var by:ByteArray = new ByteArray();
			stream.readBytes(by);
			
			var loader:Loader = new Loader();
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadCom);
			loader.loadBytes(by,new LoaderContext(false,ApplicationDomain.currentDomain));
		}
		
		private function loadCom(e:Event):void
		{
			var loader:Loader = e.currentTarget.loader as Loader;
			loader.contentLoaderInfo.removeEventListener(Event.COMPLETE,loadCom);
			if(loadArr.length>0)
			{
				doLoad();
			}else
			{
				trace("load complete")
				var testClas:Class = getDefinitionByName("com.flower.core.xml.TaskData_new") as Class;
				
				var xml:XML = testClas.DATA as XML;
				
				var txt:TextField = new TextField();
				txt.width = 960;
				txt.height = 560;
				txt.text = xml;
				addChild(txt);
				trace(xml)
			}
		}
	}
}